package com.kk.util;

import org.hibernate.internal.util.StringHelper;

import java.util.Collection;
import java.util.Date;

public class ToolUtils {

    public static boolean isNotEmpty(Object object) {
        return !isEmpty(object);
    }
    public static boolean isEmpty(Object object) {
        if (object == null) {
            return true;
        }
        if (object != null) {
            if (object instanceof Collection) {
                Collection collection = (Collection) object;
                if (collection.size() > 0) {
                    return false;
                }
            }
            if (object instanceof String) {
                String s = (String) object;
                if (StringHelper.isNotEmpty(s.trim())) {
                    return false;
                }
            }
            return false;
        }
        return true;
    }

    public static String dateType(Object o) {
        return o instanceof Date ? DateUtils.formatDate((Date)o) : o.toString();
    }
}
